package com.osscode.framework.core.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
   private static  String dateFormat="yyyy-MM-dd HH:mm:ss.SSS";
   
   public String getNowDateString()
   {
	   return new SimpleDateFormat(dateFormat).format(new Date());
   }
   
   public long  getTimeInMillisByDateString(String dateString)
   {
	   long millis=0;
	   SimpleDateFormat sdf=new SimpleDateFormat(dateFormat);
		try {
			sdf.parse(dateString);
			millis=sdf.getCalendar().getTimeInMillis();
		} catch (ParseException e) {

		}
	    return millis;
   }
}
